home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_10 / saks / comstr6.cpp < prev    next >
C/C++ Source or Header  |  1994-08-08  |  710b  |  43 lines

  1. Listing 8 - Non-inline member function definitions for str objects that 
  2. can be placed in a container of common *.
  3.  
  4. //
  5. // comstr6.cpp - a "common" str type for containable str objects
  6. //
  7.  
  8. #include "comstr6.h"
  9.  
  10. common &comstr::operator=(const common &c)
  11.     {
  12.     e = ((const comstr &)c).e;
  13.     return *this;
  14.     }
  15.  
  16. common *comstr::dup() const
  17.     {
  18.     return new comstr(*this);
  19.     }
  20.  
  21. size_t comstr::size() const
  22.     {
  23.     return sizeof(comstr);
  24.     }
  25.  
  26. ostream &comstr::write(ostream &s) const
  27.     {
  28.     return s << e;
  29.     }
  30.  
  31. istream &comstr::read(istream &s)
  32.     {
  33.     return s >> e;
  34.     }
  35.  
  36. comstr::~comstr() { }
  37.  
  38. comstr::operator str &()
  39.     {
  40.     return e;
  41.     }
  42.  
  43.